package main

import "fmt"

func main() {
	nums := []int{9, 1, 4, 5, 2, 3, 8}
	sort(nums)
	fmt.Println(nums)

	i := 0
	fmt.Println(i)
}

func sort(nums []int) {
	// 判断上一次有没有发生改变
	hasChange := true

	for i := 0; i < len(nums)-1 && hasChange; i++ {
		hasChange = false

		for j := 0; j < len(nums)-1-i; j++ {
			if nums[j] > nums[j+1] {
				temp := nums[j]
				nums[j] = nums[j+1]
				nums[j+1] = temp
				hasChange = true
			}
		}
	}
}

func swap(nums []int, j int) {

}
